<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <!--Inicia la composicion de la pagina en la plantilla-->
    <ui:composition template="/resource/template/plantilla.xhtml">

        <!--Segmento que define el contenido del header-->
        <ui:define name="head">
            <h:head>
                <f:loadBundle basename="person.asignature.label_#{logged.loggedIdiom}" var="label" />
                <f:loadBundle basename="person.asignature.message_#{logged.loggedIdiom}" var="message" />
                <f:loadBundle basename="person.asignature.help_es" var="help" />
                <script>
                    function verificar(dato)
                    {
                        var agree = confirm(dato);
                        if (agree)
                            return true;
                        else
                            return false;
                    }
                </script>
            </h:head>
        </ui:define>
        <!--Segmento que define el contenido de la pagina-->
        <ui:define name="content">
            <h:body>
                <h:outputText value="#{message.m0}" class="label" rendered="#{!access.visit}"/>
                <h:form rendered="#{access.visit}">  
                    <p:growl id="messages" showDetail="true"/>  
                    <div class="field">
                        <h:outputText value="#{label.field1}" class="label"/>
                        <h:inputText id="nombre" class="textfield" value="#{person_asignature.nombre}" required="#{param['required']=='true'}" requiredMessage="#{message.m21}"/>
                        <p:watermark for="nombre" value="#{label.field1}"/>
                        <h:outputText class="required" value="*"/>
                    </div>
                    <h:commandButton value="#{label.button1}" class="button" actionListener="#{person_asignature.insert}" rendered="#{access.add}" onclick="return verificar('#{message.m7}')">
                        <f:param name="required" value="true"/>
                    </h:commandButton>
                    <h:commandButton value="#{label.button2}" class="button" actionListener="#{person_asignature.update}" rendered="#{access.update}" onclick="return verificar('#{message.m8}')">
                        <f:param name="required" value="true"/>
                    </h:commandButton>
                    <h:commandButton value="#{label.button3}" class="button" actionListener="#{person_asignature.delete}" rendered="#{access.delete}" onclick="return verificar('#{message.m9}')"/>
                    <h:commandButton value="#{label.button4}" class="button" actionListener="#{person_asignature.clear}"/>
                </h:form>
                <h:form>
                    <c:set var="list" value="#{person_asignatureFind.listByLoggedId}"/>
                    <h:panelGroup layout="block" class="tableWrapper" rendered="#{not empty list}">
                        <h:dataTable var="p" value="#{list}" class="dataTable" >
                            <h:column >
                                <f:facet name="header"></f:facet>
                                <h:commandLink styleClass="editButton" actionListener="#{person_asignature.selectedTempId(p.id)}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">#{label.field1}</f:facet>
                                <h:outputText value="#{p.nombre}"/>
                            </h:column>
                        </h:dataTable>
                    </h:panelGroup>
                </h:form>
            </h:body>
        </ui:define>

        <!--Segemento donde se define un texto de ayuda para que el usuario pueda utilizar el formulario del contenido-->
        <ui:define name="slideHelper">
            <h3>#{help.title1} </h3>
            #{help.detail1a}
            <p>
                #{help.title2}
                <ul>
                    <li>#{help.detail2a}</li>
                </ul> 
                #{help.title3}
                <ul>
                    <li>#{help.detail3a}</li>
                    <li>#{help.detail3b}</li>
                    <li>#{help.detail3c}</li>

                </ul>
            </p>
        </ui:define>
    </ui:composition>
</html>

